from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import gettext, gettext_lazy as _
from oAuth.models import NewUser, Informations, Tasks, Shortages, Machines

# Register your models here.

class NewUserAdmin(UserAdmin):

    fieldsets = (
        (None, {'fields': ('username', 'password' )}),
        (_('Personal info'), {'fields': ('name', 'last_name' , 'sex')}),
        (_('Permissions'), {'fields': ( 'is_staff', 'is_superuser', 'user_permissions', 'roles')}),
        (_('Important dates'), {'fields': ('date_joined',)}),
    )

    list_display = ('id', 'username', 'sex', 'roles', 'last_login')
    list_display_links = ('id', 'username', 'sex','roles',  'last_login')

admin.site.register(NewUser, NewUserAdmin)


class InformationsAdmin(admin.ModelAdmin):
    list_display = ('id', 'number','shortage', 'detail', 'occure_time', 'cause', 'option', 'person_responsibility',
                    'person_record', 'record_time', 'condition', 'is_delete')
    list_display_links= ('id', 'number','shortage', 'detail', 'occure_time', 'cause', 'option', 'person_responsibility',
                    'person_record', 'record_time', 'condition', 'is_delete')

admin.site.register(Informations, InformationsAdmin)

class TasksAdmin(admin.ModelAdmin):

    list_display = ('id',  'number', 'description', 'person_record', 'person_finish', 'is_fix')
    list_display_links = ('id',  'number', 'description', 'person_record', 'person_finish', 'is_fix')
admin.site.register(Tasks, TasksAdmin)

class ShortageAdmin(admin.ModelAdmin):

    list_display = ('id', 'shortage', 'count')
    list_display_links = ('id', 'shortage', 'count')

admin.site.register(Shortages, ShortageAdmin)

class MachinesAdmin(admin.ModelAdmin):

    list_display = ('id', 'machine', 'count')
    list_display_links = ('id', 'machine', 'count')


from import_export.admin import ImportExportModelAdmin

class PersonAdmin(ImportExportModelAdmin):
   pass
admin.site.register(Machines, MachinesAdmin)